package com.sig.net;

import java.util.List;

import org.apache.http.NameValuePair;

import com.sig.net.core.Net;

public class NetGraphe{
	
	private static String URL_MAP_XML = "map";
	public static String getMapXML(){
		return Net.requeteGet(URL_MAP_XML, null);
	}

	private static String URL_BATIMENT_XML = "batiment";
	public static String getBatimentXML(){
		return Net.requeteGet(URL_BATIMENT_XML, null);
	}

	private static String URL_VERSION = "struts";
	private static String GRAPHE_VERSION = "version";
	public static String getVersion(){
		List<NameValuePair> donnees = Net.construireDonnes(GRAPHE_VERSION,"1");
		return Net.requeteGet(URL_VERSION, donnees);
	}

	private static String URL_GRAPHE_JSON = "graphe";
	private static String GRAPHE_GRAPHE = "graphe";
	private static String GRAPHE_BATIMENT = "batiment";
	public static String getGrapheJSon(boolean batiment){
		List<NameValuePair> donnees = Net.construireDonnes(GRAPHE_GRAPHE,"1");
		if(batiment)
			Net.add(donnees,GRAPHE_BATIMENT,"1");
		
		return Net.requeteGet(URL_GRAPHE_JSON, donnees);
	}

	private static String URL_CHEMIN = "chemin";
	private static String CHEMIN_SOURCE = "source";
	private static String CHEMIN_DESTINATION = "destination";
	private static String CHEMIN_BATIMENT = "batiment";
	public static String getCheminJSon(boolean batiment, String idSource, String idDestination){
		List<NameValuePair> donnees = Net.construireDonnes(
				CHEMIN_SOURCE,idSource,
				CHEMIN_DESTINATION,idDestination
				);
		if(batiment)
			Net.add(donnees,CHEMIN_BATIMENT,"1");

		return Net.requeteGet(URL_CHEMIN, donnees);
	}

}
